import axios from 'axios'
import store from '@/store'
// 一次封装
const request = axios.create({
  baseURL: 'http://upenglish.ayvvv.cn/index.php/api/'
})
request.interceptors.request.use(function (config) {
  const user = store.state.user
  // console.log(user)
  if (user) {
    config.headers.token = user
  }
  return config
}, function (error) {
  // console.log(error)
  return Promise.reject(error)
})
export default request
